#pragma once
#include "Audio.h"
using namespace Reign::Core;
using namespace System::Collections::Generic;

namespace Reign
{namespace Audio
{namespace XAudio
{
	ref class SoundWAV;

	public ref class SoundWAVInstance : Disposable, SoundInstanceI
	{
		#pragma region Properties
		internal: IXAudio2SourceVoice* instance;
		private: XAUDIO2_BUFFER* buffer;

		private: SoundStates state;
		public: property SoundStates State {virtual SoundStates get();}

		private: bool looped;
		public: property bool Looped {virtual bool get();}

		public: property float Volume {virtual float get(); virtual void set(float value);}
		#pragma endregion
		
		#pragma region Constructors
		public: SoundWAVInstance(SoundWAV^ sound, bool looped);
		public: ~SoundWAVInstance();
		private: void null();
		#pragma endregion

		#pragma region Methods
		public: virtual void Update();
		public: virtual void Play();
		public: virtual void Play(float volume);
		public: virtual void Pause();
		public: virtual void Stop();
		#pragma endregion
	};

	public ref class SoundWAV : SoundWAVI
	{
		#pragma region Properties
		internal: Audio^ audio;
		internal: WAVEFORMATEX* waveFormat;
		internal: byte* buffer;
		internal: int bufferLength;
		#pragma endregion

		#pragma region Constructors
		public: SoundWAV(DisposableI^ parent, string^ fileName, int instanceCount, bool looped);
		public: ~SoundWAV();
		private: void null();
		#pragma endregion
	};
}
}
}